import React, { useEffect, useMemo, useRef, useState } from 'react'
import moment from 'moment'
import { Button, Flex } from 'antd';
import "./index.less";
import { getNextDay, getLastDay } from '../../utils'
import 'dayjs/locale/zh-cn';
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons';
export const NextAndPreDayBar = ({ onChange, currentDay }) => {

    const handleLastDay = () => {
        const newDay = getLastDay(currentDay)
        onChange?.(newDay)
    }
    const handleNextDay = () => {
        const newDay = getNextDay(currentDay)
        onChange?.(newDay)
    }
    return <Flex wrap="wrap" className='dateWrapper'>
        <Button type="primary"
            onClick={handleLastDay}
            shape="round" icon={<LeftCircleOutlined />}>  上一日</Button>
        <Button type="primary" onClick={handleNextDay} shape="round" icon={<RightCircleOutlined />} style={{ marginLeft: 30 }} >
            下一日
        </Button>
    </Flex>
}